<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib prefix="sb" uri="/struts-bootstrap-tags"%>

<!DOCTYPE html>
<html>
<s:include value="/WEB-INF/content/common/header.jsp"></s:include>
</head>
<body class="bg">
	<div class="container">
		<s:include value="/WEB-INF/content/common/title-head.jsp"></s:include>

		<div class="content">

			<s:include value="/WEB-INF/content/common/tab.jsp"></s:include>

			<script>
				$("#userTab").addClass("active");
			</script>

			<div id="body">
				<div class="row">
					<div class="col-lg-10 col-lg-offset-1">
						<div class="title">
							<h2>
								<s:if test="mode.name().equals('ADD')">
									<s:text name="page.heading.add" />
								</s:if>
								<s:elseif test="mode.name().equals('EDIT')">
									<s:text name="page.heading.edit" />
								</s:elseif>
							</h2>
						</div>
					</div>
					<div class="col-lg-10 col-lg-offset-1">
						<div>
							<s:form action="save" namespace="/irisUser" method="post"
								theme="bootstrap">
								<s:hidden name="mode" />
								<s:hidden name="irisUser.id" />
								<div class="form-group">
									<s:actionerror />
								</div>
								<fieldset>
									<div class="form-group">
										<s:text name="user.employee.id" />
										<s:textfield name="irisUser.employeeId"
											cssClass="form-control"
											placeholder="%{getText('user.iris.employee.id.placeholder')}" />
									</div>
									<div class="form-group">
										<s:text name="user.name" />
										<s:textfield name="irisUser.name" cssClass="form-control"
											placeholder="%{getText('user.iris.name.placeholder')}"
											required="true" />
									</div>
									<div class="form-group">
										<s:text name="user.initials" />
										<s:textfield name="irisUser.initials" cssClass="form-control"
											placeholder="%{getText('user.iris.initials.placeholder')}" />
									</div>
									<div class="form-group">
										<s:text name="user.gender" />
										<s:select cssClass="form-control" name="irisUser.gender"
											headerKey="0" headerValue="-- Please Select --"
											list="genderList" listKey="key" listValue="value"
											value="irisUser.gender" />
									</div>

									<div class="form-group">
										<s:text name="user.email" />
										<s:textfield name="irisUser.email" cssClass="form-control"
											placeholder="%{getText('user.iris.email.placeholder')}"
											required="true" />
									</div>
									<div class="form-group">
										<hr />
									</div>

									<s:text name="user.registration.flag" />
									<br /> 
									<label class="checkbox-inline ml30">
										<s:checkbox theme="simple" name="irisData.leftEye" value="irisData.leftEye"><s:text name="user.data.left.eye" /></s:checkbox>
									</label>
									<label class="checkbox-inline">
										<s:checkbox theme="simple" name="irisData.rightEye" value="irisData.rightEye"><s:text name="user.data.right.eye" /></s:checkbox>
									</label>
									<label class="checkbox-inline"> 
										<s:checkbox theme="simple" name="irisData.card" value="irisData.card"><s:text name="user.data.card" /></s:checkbox>
									</label>
									<label class="checkbox-inline"> 
										<s:checkbox theme="simple" name="irisData.pin" value="irisData.pin"><s:text name="user.data.pin" /></s:checkbox>
									</label>
									
									<div class="form-group">
										<hr />
									</div>

									<div class="form-group checkboxlist">
										<label><s:text name="group.chose" /></label> <br />
										<s:if test="mode.name().equals('EDIT')">
											<label class="ml30"><s:text name="group.assigned" /></label>
											<br />
											<div class="form-group">
												<s:if test="existingGroups.size == 0">
													<s:text name="checkbox.list.empty" />
												</s:if>
												<s:iterator value="existingGroups" status="rowIndex">
													<label class="checkbox-inline"> <input
														type="checkbox" name="selectedList" id="selectedList"
														value="<s:property value='%{id}'/>" checked="checked" />
														<s:property value="%{name}" />
													</label>
												</s:iterator>
											</div>
										</s:if>
										<label class="ml30"><s:text name="group.available" /></label>
										<br />
										<div class="form-group">
											<s:if test="availableGroups.size == 0">
												<s:text name="checkbox.list.empty" />
											</s:if>
											<s:iterator value="availableGroups" status="rowIndex">
												<label class="checkbox-inline"> <input
													type="checkbox" name="selectedList" id="selectedList"
													value="<s:property value='%{id}' />" /> <s:property
														value="%{name}" />
												</label>
											</s:iterator>
										</div>
									</div>
									<div class="text-center">
										<s:submit cssClass="btn btn-primary"
											value="%{getText('global.submit')}" />
										<s:if test="mode.name().equals('EDIT')">
											<s:url var="deleteUserUrl" action="delete"
												namespace="/irisUser" includeParams="none" escapeAmp="false">
												<s:param name="id" value="%{irisUser.id}" />
											</s:url>
											<s:a href="%{#deleteUserUrl}"
												onclick="return confirmDelete()" cssClass="btn btn-warning">
												<s:property value="%{getText('global.delete')}" />
											</s:a>
										</s:if>
									</div>
								</fieldset>
							</s:form>
						</div>
					</div>
				</div>
			</div>
		</div>
		<s:include value="/WEB-INF/content/common/footer.jsp"></s:include>
	</div>
</body>
</html>
